package atm;

import java.util.Date;

/**
* 收据口类
* @author  莫东林
* @version 2018/11/17
*/
public class Receipt {
	//收据显示内容
	private String text = "";

	/**
	 * 构造凭条信息
	 */
	@SuppressWarnings("deprecation")
	public void setText(String card_no, String trade_no, int type, Double balance, Date time){
		text = "";
		text = "交易时间：" + time.toLocaleString() + "\n";
		text += "受理银行卡号：" + card_no + "\n";
		
		switch(type){
		//取款
		case 1:
			text += "交易类型：取款" + "\n";
			break;
		//存款
		case 2:
			text += "交易类型：存款" + "\n";
			break;
		//转账
		case 3:
			text += "交易类型：转账" + "\n";
			text += "转入银行卡号：" + trade_no + "\n";
			break;
		}
		text += "交易金额：" + balance;
	}
	
	public String getText() {
		return text;
	}



	public void setText(String text) {
		this.text = text;
	}



	/**
	 * 获取状态字符串
	 */
	public String toString() {
		String output = "{";
		output += "\"text\":\"" + this.text + "\"";
		output += "}";
		return output;
	}
	
}
